package com.cloud.feeling.ststem.inteceptor;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.google.common.collect.Lists;

@Configuration
public class WebMvcConf implements WebMvcConfigurer {

  @Autowired
  private AuthActionInterceptor authActionInterceptor;
  
  @Override
  public void addInterceptors(InterceptorRegistry registry) {
	  //registry.addInterceptor(authInterceptor).addPathPatterns("/**");
	  List<String> paths=new ArrayList<>();
	  paths.add("/login");
	  paths.add("/assets/**");
	  paths.add("/css/**");
	  paths.add("/font/**");
	  paths.add("/jquery-context-menu/**");
	  paths.add("/js/**");
	  paths.add("/myjs/**");
	  paths.add("/plug-in/**");
	  paths.add("/jquery-cookie/**");
	  paths.add("/bootstrap-table/**");
	  paths.add("/zui/***");
	  paths.add("/zTree/***");
	  paths.add("/treegrid/***");
	  paths.add("/bootstrap-jqTreeGrid/***");
	  registry.addInterceptor(authActionInterceptor)
	        .addPathPatterns("/**/**")
	        .excludePathPatterns(paths);
  }

}
